package com.woniuxy.amusementparkos.service.wyh.imp;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.woniuxy.amusementparkos.dao.wyh.CustomerDao;
import com.woniuxy.amusementparkos.entity.wyh.Customer;
import com.woniuxy.amusementparkos.service.wyh.CustomerService;

@Service
public class CustomerServiceImp implements CustomerService {
		@Autowired
	CustomerDao customerDao;
		
		//根据id查询
	@Override
	public Customer getById(int customer_id) {
		
		return customerDao.getById(customer_id);
	}
	//查询所有
	@Override
	public List<Customer> getAll() {
	
		return customerDao.getAll();
	}
	//新增顾客
	@Override
	public void addCustomer(Customer customer) {
	
		customerDao.addCustomer(customer);
		
	}
	//更新顾客信息
	@Override
	public void updateCustomer(Customer customer) {
		customerDao.updateCustomer(customer);
		
	}
	
	//返回最后插入的客户id
	@Override
	public int seletLastAddId() {
		
		return customerDao.seletLastAddId();
	}
	
	//新增然后返回主键id
	@Override
	public int addBackId(Customer customer) {
		customerDao.addCustomer(customer);
		
		//返回最后插入id  即当前插入信息id
		int seletLastAddId = customerDao.seletLastAddId();
		
		return seletLastAddId;
	}
	@Override
	public List<Customer> getAllBy(Customer customer) {
		
		return customerDao.getAllBy(customer);
	}

}
